<template>

    <el-row>
        <el-button-group>
            <el-button plain type="primary" @click="doctorSign()">医生图片签名</el-button>
            <el-button plain type="primary" @click="signUrl()">网络图片签名</el-button>
        </el-button-group>
        <el-button-group>
            <el-button plain type="primary" @click="popSignPanl('#patient-sign')">患者手写签名</el-button>
            <el-button plain type="primary" @click="popSignPanl('#patient-family-sign')">家属手写签名</el-button>
        </el-button-group>
    </el-row>
    <Source src="/code/Signature.vue"></Source>
    <Editor doc="/mock/sign.html"  @load="onLoad" style="margin: 10px 0;"></Editor>
    
    </template>
    
    
    <script setup>
    
    let editor = null
    //文档加载完成
    const onLoad = function(e) {
         editor = e.target.contentWindow.editor
    }
    
    //患者签名
    const popSignPanl = function(id) {

        editor.$(id).trigger('dblclick')
    }

    //网络图片签名
    const signUrl = function() {
        editor.$('#doctor-sign').attr('src','https://ss0.baidu.com/7Po3dSag_xI4khGko9WTAnF6hhy/zhidao/pic/item/eac4b74543a98226d07efeeb8a82b9014b90ebbb.jpg')
    }
    
    
    //医生签名
    const doctorSign = function() {
        editor.$('#doctor-sign').attr('src','')
    }
    
    </script>